package com.xcl.mapper;

import com.xcl.pojo.Article;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ArticleMapper {
    //查询所有文章
//    @Select("select * from article")
    public List<Article> findArticle(@Param("categoryId") Integer categoryId,@Param("state") String state);

    //删除文章
    @Delete("delete from article where id=#{id}")
    public Integer deleteArticle(Integer id);

    //添加文章
    @Insert("insert into article(title,content,state,category_id,create_user,create_time,update_time)  " +
            "values (#{title},#{content},#{state},#{categoryId},#{createUser},now(),now())" )
    public Integer addArticle(Article article);

}
